#ifndef MYGDIPLUS_H
#define MYGDIPLUS_H

#pragma comment (lib, "Gdiplus.lib")
#include "MyGraphic.h"
#include <windows.h>
#include <stdio.h>
#include <GdiPlus.h>
using namespace Gdiplus;

class MyGDIPlus : public MyGraphic
{
private:	
	Graphics*	g;
	ULONG_PTR	gdiplusToken;
public:	
	//Constructor
	MyGDIPlus() {};
	MyGDIPlus(HWND handle) {
		GdiplusStartupInput gdiplusStartupInput;
		//ULONG_PTR			gdiplusToken;

		GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
		
		g = new Graphics(handle);		
	}
	
	void DrawLine(char stroke[], float strokeWidth, int x1, int y1, int x2, int y2) {
		g->DrawLine(new Pen(Color(stroke[0], stroke[1], stroke[2]), strokeWidth), x1, y1, x2, y2);
	}
	void DrawRectangle(char stroke[], float strokeWidth, int x, int y, int width, int height) {		
		g->DrawRectangle(new Pen(Color(stroke[0], stroke[1], stroke[2]), strokeWidth), x, y, width, height);
	}
	void DrawEllipse(char stroke[], float strokeWidth, int x, int y, int width, int height) {
		g->DrawEllipse(new Pen(Color(stroke[0], stroke[1], stroke[2]), strokeWidth), x, y, width, height);
	}
	void FillRectangle(char color[], int x, int y, int width, int height) {
		g->FillRectangle(new SolidBrush(Color(color[0], color[1], color[2])), x, y, width, height);
	}
	void FillEllipse(char color[], int x, int y, int width, int height) {
		g->FillEllipse(new SolidBrush(Color(color[0], color[1], color[2])), x, y, width, height);
	}
	//Destructor
	~MyGDIPlus() {
		GdiplusShutdown(gdiplusToken);
	}
};
#endif